import $http from '../../../servers/http';
import { Result } from '../../schema/Result';
/* 下载管理-下载任务管理
---------------------------------------------------------------- */
import { DownloadTaskInfo, DownloadTaskListInfo } from '../../schema/DownloadTask';

/**创建下载任务-任务详情-通话记录-导出 */
export const createDownloadTask = (data: DownloadTaskInfo): Promise<Result<null>> => {
  return $http.post({
    url: '/icms/downloadmanage/downloadtasks',
    data,
  });
};

/**下载任务-消息状态变更 */
export const modifyDownloadTask = (taskId: number): Promise<Result<null>> => {
  return $http.post({
    url: `/icms/downloadmanage/downloadtasks/${taskId}/cancelfocus`,
  });
};

/**删除下载任务 */
export const deleteDownloadTask = (): Promise<Result<null>> => {
  return $http.delete({
    url: `/icms/downloadmanage/downloadtasks`,
  });
};

/**查询下载任务列表 */
export const getDownloadTaskList = (data: {
  pageSize: number;
  pageNo: number;
}): Promise<Result<DownloadTaskListInfo[]>> => {
  return $http.get({
    url: '/icms/downloadmanage/downloadtasks',
    data,
  });
};

/**查询新下载任务总数 */
export const getDownloadFocusCount = (): Promise<Result<null>> => {
  return $http.get({
    url: '/icms/downloadmanage/downloadtasks/focuscount',
  });
};
